const ApiErrorNames = {
	UnknownError: { code: -1, message: '未知错误' },
	UserNotExist: { code: 1001, message: '用户不存在' },
	UserNameNotNull: { code: 1002, message: '用户名不能为空' },
	OldPassErr: { code: 4895, message: '原密码错误' },
	SetPassDataNull: {
		code: 4894,
		message: '缺少参数，oldpass，newpass， confirmpass',
	},
	LoginPhoneNotNull: { code: 4894, message: '手机号不能为空' },
	LoginNotUser: { code: 4896, message: '用户不存在' },
	LoginUserPassErr: { code: 4897, message: '用户名或密码错误' },
	RegistryNameEndPassNotNull: { code: 4898, message: '手机号和密码不能为空' },
	RegistryUserisExist: { code: 4895, message: '用户已存在' },
	StePassConfirmpassDontMatch: {
		code: 4892,
		message: '两次输入的密码不一致',
	},
	NoParamsData: { code: 4893, message: '缺少参数' },
	RoleNameExist: { code: 4893, message: '角色名已存在' },
	NoData: { code: 4893, message: '没有数据' },
	MenuListFail: { code: 4893, message: '获取菜单列表失败' },
	MenuUpdateFail: { code: 4893, message: '菜单更新失败' },
	MenuDeleteFail: { code: 4893, message: '菜单删除失败' },
	NoData: { code: 4893, message: '没有数据' },
	ShopWhiteExist: { code: 4893, message: '店铺白名单已存在' },
	NoProxyId: { code: 4893, message: '不存在该代理' },
	MateriallistNAN: { code: 4893, message: '素材为空' },
	MateriallisType: { code: 4893, message: '素材type1:边框，2图标' },
	MateriallistPath: { code: 4893, message: '缺少素材路径：path' },
	NogetCooke: { code: 4037, message: '未获取对应的ci' },
	queryTypeErr: { code: 4893, message: '参数类型错误' },
	noGetAiApi: { code: 4893, message: '请求API不存在' },
	nogetText: (text) => {
		return { code: 4893, message: '缺少参数：' + text + '不存在' }
	},
	selectInDengtData: (text) => {
		return { code: 4893, message: text }
	},
	ADD_GOODS_FAIL: { code: 4893, message: '添加商品失败' },
	PHONE_FORMAT_ERROR: { code: 4893, message: '手机号格式错误' },
	SEND_CODE_TOO_FREQUENT: { code: 48995, message: '发送验证码太频繁' },
	CODE_ERROR: { code: 48996, message: '验证码错误' },
	CODE_ERROR_TIMEOUT: { code: 48997, message: '验证码超时' },
	CODE_ERROR_USED: { code: 48998, message: '验证码已使用' },
	PHONE_NOT_EXIST: { code: 4893, message: '手机号不存在' },
	sendSmsErr: (data) => {
		return data
	},
	SHOP_ID_NOT_EXIST: { code: 48975, message: '店铺不存在' },
	SHOP_ID_NOT_EXIST_OR_NOT_BING: {
		code: 48975,
		message: '店铺不存在或未绑定',
	},
	SHOP_ID_BINDED: { code: 48976, message: '已绑定相同账号' },
	SHOP_ID_BINDED_OTHER: (phone) => {
		return { code: 48977, message: 'b-' + phone }
	},
	NO_SHOP_DATA: { code: 48978, message: '店铺不存在' },
	ERR_JUMP_CHEACK_API: { code: 48979, message: '非法调用API' },
	NO_REF_ORDER: { code: 48980, message: '没有对应的订单' },
	NO_FUNC_TYPE: { code: 48981, message: '没有对应的功能' },
	NO_JIFEN: { code: 48982, message: '积分不足请前往充值' },
	ORSER_ERR_STATUS: { code: 48983, message: '订单异常' },
	REFOTOEK_ERR: { code: 48984, message: 'refresh_token无效 请重新登陆' },
	TOKEN_EXPIRED: { code: 747, message: 'token已过期' },
	TOKEN_INVALID: { code: 748, message: '无效的token' },
	SERVER_ERR: { code: 500, message: '服务器异常请重试' },
	ADD_ISINFOTER: { code: 48985, message: '重复添加该type配置' },
	SYSTEM_ERROR: { code: 65552, message: '订单ID不存在' },

	NO_PERMISSION: { code: 48986, message: '没有权限' },
	NOT_FOUND: { code: 451852, message: '没有可结算金额' },
}

ApiErrorNames.getErrorInfo = (errorInfo) => {
	// 如果没有对应的错误信息，默认'未知错误'
	if (!errorInfo) {
		errorInfo = ApiErrorNames.UnknownError
	}

	return errorInfo
}

export default ApiErrorNames
